home *** CD-ROM | disk | FTP | other *** search
- on carga Niv, Sala, Primero
- set Primero to Primero - 1
- set MaxCol to 0
- set TabLinIni to []
- if the machineType = 256 then
- openXLib(the pathName & "fileio.dll")
- end if
- set Fichero to FileIO(mnew, "read", the pathName & "Niv" & Niv & Sala & ".txt")
- if objectp(Fichero) then
- set fich to Fichero(mReadFile)
- set max to length(fich)
- set i to 0
- repeat while i < max
- set i to i + 1
- set car to char i to i of fich
- set linea to EMPTY
- repeat while (i <= max) and (charToNum(car) <> 10)
- if getOne(["Z", "-", "X", "\", "/", "|", " "], car) then
- set linea to linea & car
- else
- if charToNum(car) = 13 then
- nothing()
- else
- alert("car√°cter desconocido : " & car && chartnum(car))
- end if
- end if
- set i to i + 1
- set car to char i to i of fich
- end repeat
- repeat while the last char in linea = " "
- set linea1 to char 1 to length(linea) - 1 of linea
- set linea to linea1
- end repeat
- add(TabLinIni, linea)
- end repeat
- Fichero(mdispose)
- end if
- if the machineType = 256 then
- closeXLib(the pathName & "fileio.dll")
- end if
- set max to 0
- repeat with Lin = 1 to count(TabLinIni)
- if MaxCol < length(getAt(TabLinIni, Lin)) then
- set MaxCol to length(getAt(TabLinIni, Lin))
- end if
- end repeat
- set MaxLin to count(TabLinIni)
- set TabLin to []
- repeat with Num = 1 to MaxLin * MaxCol
- add(TabLin, " ")
- end repeat
- repeat with Lin = 1 to count(TabLinIni)
- set IndCar to 1
- set linea to getAt(TabLinIni, Lin)
- repeat with IndCar = 1 to length(linea)
- setAt(TabLin, ((Lin - 1) * MaxCol) + IndCar, char IndCar to IndCar of linea)
- end repeat
- end repeat
- set Deb to 1
- repeat with Lin = MaxLin down to 1
- repeat with Col = 1 to MaxCol
- if getAt(TabLin, ((Lin - 1) * MaxCol) + Col) = "Z" then
- setAt(TabLin, ((Lin - 1) * MaxCol) + Col, Deb)
- set Deb to Deb + 8
- end if
- end repeat
- end repeat
- set TabDe to []
- set TabA to []
- set Lin to 1
- repeat while Lin <= MaxLin
- set Col to 1
- repeat while Col <= MaxCol
- set Ind to ((Lin - 1) * MaxCol) + Col
- set Num to value(getAt(TabLin, Ind))
- if Num > 0 then
- if Col < MaxCol then
- if getAt(TabLin, Ind + 1) = "-" then
- set NumTr to value(getAt(TabLin, Ind + 2))
- if NumTr > 0 then
- add(TabDe, Primero + Num + 6)
- add(TabDe, Primero + NumTr + 2)
- add(TabA, Primero + NumTr + 6)
- add(TabA, Primero + Num + 2)
- end if
- end if
- end if
- if Lin < MaxLin then
- if (getAt(TabLin, Ind + MaxCol + 1) = "\") or (getAt(TabLin, Ind + MaxCol + 1) = "X") then
- set NumTr to value(getAt(TabLin, Ind + (MaxCol * 2) + 2))
- if NumTr > 0 then
- add(TabDe, Primero + Num + 5)
- add(TabDe, Primero + NumTr + 1)
- add(TabA, Primero + NumTr + 5)
- add(TabA, Primero + Num + 1)
- end if
- end if
- end if
- if (Lin < MaxLin) and (Col > 1) then
- if (getAt(TabLin, Ind + MaxCol - 1) = "/") or (getAt(TabLin, Ind + MaxCol - 1) = "X") then
- set NumTr to value(getAt(TabLin, Ind + (MaxCol * 2) - 2))
- if NumTr > 0 then
- add(TabDe, Primero + Num + 3)
- add(TabDe, Primero + NumTr + 7)
- add(TabA, Primero + NumTr + 3)
- add(TabA, Primero + Num + 7)
- end if
- end if
- end if
- if Lin < MaxLin then
- if getAt(TabLin, Ind + MaxCol) = "|" then
- set NumTr to value(getAt(TabLin, Ind + (MaxCol * 2)))
- if NumTr > 0 then
- add(TabDe, Primero + Num + 4)
- add(TabDe, Primero + NumTr)
- add(TabA, Primero + NumTr + 4)
- add(TabA, Primero + Num)
- end if
- end if
- end if
- set Col to Col + 2
- next repeat
- end if
- set Col to Col + 1
- end repeat
- set Lin to Lin + 2
- end repeat
- put TabDe
- put TabA
- end
-